{{ header }}{{ column_left }}
<div id="content">
  <div class="page-header">
    <div class="container-fluid">
      <div class="float-right">
        <button type="submit" form="form-user-group" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary"><i class="fas fa-save"></i></button>
        <a href="{{ cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-light"><i class="fas fa-reply"></i></a></div>
      <h1>{{ heading_title }}</h1>
      <ol class="breadcrumb">
        {% for breadcrumb in breadcrumbs %}
          <li class="breadcrumb-item"><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
        {% endfor %}
      </ol>
    </div>
  </div>
  <div class="container-fluid">
    {% if error_warning %}
      <div class="alert alert-danger alert-dismissible"><i class="fas fa-exclamation-circle"></i> {{ error_warning }}
        <button type="button" class="close" data-dismiss="alert">&times;</button>
      </div>
    {% endif %}
    <div class="card">
      <div class="card-header"><i class="fas fa-pencil-alt"></i> {{ text_form }}</div>
      <div class="card-body">
        <form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-user-group">
          <div class="form-group row required">
            <label class="col-sm-2 col-form-label" for="input-name">{{ entry_name }}</label>
            <div class="col-sm-10">
              <input type="text" name="name" value="{{ name }}" placeholder="{{ entry_name }}" id="input-name" class="form-control"/>
              {% if error_name %}
                <div class="invalid-tooltip">{{ error_name }}</div>
              {% endif %}
            </div>
          </div>
          <div class="form-group row">
            <label class="col-sm-2 col-form-label">{{ entry_access }}</label>
            <div class="col-sm-10">
              <div class="form-control" style="height: 300px; overflow: auto;">
                <label class="form-check"><input type="checkbox" class="form-check-input" onchange="$(this).parent().parent().find(':checkbox').not(this).prop('checked', $(this).prop('checked'));"/> {{ text_all }}</label>
				{% for permission_group in permission_groups %}
				<fieldset>
				<legend>{{ permission_group.name }}</legend>
					<div class="container">
						<div class="row">
								{% for permission in permission_group.permissions %}
								  <div class="col-4">
								  <label class="form-check">
									{% if permission.controller in access %}
									  <input type="checkbox" name="permission[access][]" value="{{ permission.controller }}" checked="checked" class="form-check-input"/>
									  {{ permission.name }}
									{% else %}
									  <input type="checkbox" name="permission[access][]" value="{{ permission.controller }}" class="form-check-input"/>
									  {{ permission.name }}
									{% endif %}
								  </label>
								  </div>
								{% endfor %}
						 
						</div>
					</div>
				</fieldset>
				{% endfor %}
              </div>
            </div>
          </div>
          <div class="form-group row">
            <label class="col-sm-2 col-form-label">{{ entry_modify }}</label>
            <div class="col-sm-10">
              <div class="form-control" style="height: 300px; overflow: auto;">
                <label class="form-check"><input type="checkbox" class="form-check-input" onchange="$(this).parent().parent().find(':checkbox').not(this).prop('checked', $(this).prop('checked'));"/> {{ text_all }}</label>
                {% for permission_group in permission_groups %}
				<fieldset>
				<legend>{{ permission_group.name }}</legend>
					<div class="container">
						<div class="row">
								{% for permission in permission_group.permissions %}
								  <div class="col-4">
								  <label class="form-check">
									{% if permission.controller in modify %}
									  <input type="checkbox" name="permission[modify][]" value="{{ permission.controller }}" checked="checked" class="form-check-input"/>
									  {{ permission.name }}
									{% else %}
									  <input type="checkbox" name="permission[modify][]" value="{{ permission.controller }}" class="form-check-input"/>
									  {{ permission.name }}
									{% endif %}
								  </label>
								  </div>
								{% endfor %}
						 
						</div>
					</div>
				</fieldset>
				{% endfor %}
              </div>
            </div>
          </div>
        </form>
      </div>
    </div>
  </div>
</div>
{{ footer }} 